﻿#ifndef STAGEVIEW_H
#define STAGEVIEW_H

#include <QWidget>
#include <QSettings>

class StageView : public QWidget
{
    Q_OBJECT
public:
    explicit StageView(QWidget *parent = 0);
    /**
     * @brief loadSettings 从配置文件载入各种参数
     * @param settings
     */
    void loadSettings(QSettings &settings);
    ~StageView();

public slots:
    void resetNozzleZeroPos();
    void setPosition(double x_mm, double y_mm);
    void setRowCol(int rows, int cols);
    void setNozzleZeroPos(double x_mm, double y_mm);
    void setNozzleZeroPos();
protected:
    void paintEvent(QPaintEvent * event);
private:
    double m_currentX;
    double m_currentY;

    double m_nozzleZeroPosX; // 第一个喷嘴的位置坐标
    double m_nozzleZeroPosY; // 第一个喷嘴的位置坐标

    int m_rowCount; // 喷嘴有多少行
    int m_colCount; // 喷嘴有多少列

    double m_colSpacing; //喷嘴支架的列间隔，单位 mm
    double m_rowSpacing; //喷嘴支架的行间隔，单位 mm

    double m_defaultX; //喷嘴零位的默认值
    double m_defaultY;

    void drawCross(QPainter &painter,const QPointF &center, int radius = 3);
};

#endif // STAGEVIEW_H
